<template>
  <div>
    <div class="content-item">
      <p class="bottom-line">【寝室信息】<span v-if="roomDto">{{roomDto.detailInfo}}</span></p>
      <el-table :data="bedroomUserInfoVos"
                class="table-header-gray">
        <el-table-column label="学号"
                         prop="sn"></el-table-column>
        <el-table-column label="姓名"
                         prop="name"></el-table-column>
        <el-table-column label="性别"
                         :formatter="formatGender"
                         prop="gender"></el-table-column>
        <el-table-column label="学生类型"
                         prop="studentType"></el-table-column>
        <el-table-column label="学院"
                         prop="collegeName"></el-table-column>
        <el-table-column label="专业"
                         prop="majorName"></el-table-column>
        <el-table-column label="年级"
                         prop="gradeName"></el-table-column>
        <el-table-column label="班级"
                         prop="className"></el-table-column>
        <el-table-column label="床位号"
                         prop="bedNum"></el-table-column>
      </el-table>
    </div>
    <div class="content-item">
      <p class="bottom-line">【违章记录】</p>
      <el-table :data="violationChecks"
                class="table-header-gray">
        <el-table-column label="序号"
                         type="index"></el-table-column>
        <el-table-column label="检查日期"
                         :formatter="formatTime"
                         prop="checkdate"></el-table-column>
        <el-table-column label="违章内容"
                         prop="content"></el-table-column>
        <el-table-column label="状态"
                         :formatter="formatVioStatus"
                         prop="status"></el-table-column>
      </el-table>
    </div>
    <div class="content-item">
      <p class="bottom-line">【卫生记录】</p>
      <el-table :data="healthCheckDetails"
                class="table-header-gray">
        <el-table-column label="序号"
                         type="index"></el-table-column>
        <el-table-column label="检查日期"
                         :formatter="formatTime"
                         prop="createAt"></el-table-column>
        <el-table-column label="检查人"
                         prop="checkUserName"></el-table-column>
        <el-table-column label="得分"
                         :formatter="formatScoreLevel"
                         prop="score"></el-table-column>
      </el-table>
    </div>
  </div>
</template>
<script>
import { formatTool } from '@/tools/mixin'
import { getBedroomCheckUsingGET } from '@api/auto'
export default {
  name: '',
  props: {
  },
  mixins: [formatTool],
  components: {},
  data () {
    return {
      roomDto: {},
      healthCheckDetails: [],
      bedroomUserInfoVos: [],
      violationChecks: []
    }
  },
  created () {
    let id = this.$route.query.id
    this.getBedroomCheckUsingGET(id)
  },
  mounted () { },
  methods: {
    getBedroomCheckUsingGET (id) {
      getBedroomCheckUsingGET(id)
        .then(res => {
          this.roomDto = res.data && res.data.roomDto
          this.healthCheckDetails = res.data && res.data.healthCheckDetails
          this.bedroomUserInfoVos = res.data && res.data.bedroomUserInfoVos
          this.violationChecks = res.data && res.data.violationChecks
        })
    }
  }
}
</script>
<style lang='less' scoped>
.bottom-line {
  border-bottom: 1px solid #eee;
  padding-bottom: 5px;
}
</style>
